package com.googlecode.ocl2sqlcompiler;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 
 * @author Renato Miceli
 * 
 */
public class ParamList {

	public List<OCLSemanticObject<String>> params;

	public ParamList() {
		this.params = new ArrayList<OCLSemanticObject<String>>();
	}

	public ParamList(ParamList list) {
		this.params = new ArrayList<OCLSemanticObject<String>>(list.params);
	}

	public ParamList(OCLSemanticObject<String>... params) {
		this.params = new ArrayList<OCLSemanticObject<String>>(Arrays.asList(params));
	}

	public void add(OCLSemanticObject<String> obj) {
		this.params.add(obj);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object obj) {
		if (!ParamList.class.isInstance(obj)) {
			return false;
		}
		ParamList list = (ParamList) obj;
		if (list.params.size() != this.params.size()) {
			return false;
		}
		for (int i = 0; i < params.size(); i++) {
			if (list.params.get(i).type != this.params.get(i).type) {
				return false;
			}
		}
		return true;
	}

}
